package com.cookor.poi.modules.phy.service;

import com.cookor.poi.common.persistence.DataEntity;
import com.cookor.poi.common.persistence.Page;
import com.cookor.poi.common.service.CrudService;
import com.cookor.poi.common.utils.JedisUtils;
import com.cookor.poi.modules.phy.dao.TBannerPicDao;
import com.cookor.poi.modules.phy.entity.TBannerPic;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true)
public class TBannerPicService extends CrudService<TBannerPicDao, TBannerPic> {
  public TBannerPic get(String id) {
    return (TBannerPic)super.get(id);
  }
  
  public List<TBannerPic> findList(TBannerPic tBannerPic) {
    return super.findList( tBannerPic);
  }
  
  public Page<TBannerPic> findPage(Page<TBannerPic> page, TBannerPic tBannerPic) {
    return super.findPage(page,  tBannerPic);
  }
  
  @Transactional(readOnly = false)
  public void save(TBannerPic tBannerPic) {
    super.save( tBannerPic);
    tBannerPic = new TBannerPic();
    tBannerPic.setTenantId(Integer.valueOf(5));
    tBannerPic.setDelFlag("0");
    JedisUtils.setObject("bannerPics", findList(tBannerPic), 1800);
  }
  
  @Transactional(readOnly = false)
  public void delete(TBannerPic tBannerPic) {
    super.delete( tBannerPic);
    JedisUtils.setObject("bannerPics", findList(tBannerPic), 1800);
  }
}
